<template>
  <contents ref="contents" class="wantBuy_page" :heightInclude="['navBar']">
    <Search @change="searchChange" />
    <mescroll-item ref="mescrollItem" :searchVal="searchVal" />
    <view class="publishBtn" @click="navSwitch('/pages/wantBuy/form')"
      >{{ $t('locales.publishPurchase') }}</view
    >
  </contents>
</template>
<script>
import Search from '@/components/wantBuySearch'
import MescrollItem from '@/components/wantBuyGoodsList'
import MescrollCompMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-comp.js'

export default {
  mixins: [MescrollCompMixin],
  components: {
    Search,
    MescrollItem
  },
  data() {
    return {
      searchVal: {}
    }
  },

  onLoad() {},

  onShow() {
    this.$nextTick(() => {
      uni.$on('onRefresh', () => {
        this.$refs.mescrollItem.mescroll.resetUpScroll()
        uni.$off('onRefresh')
      })
    })
  },

  methods: {
    searchChange(val) {
      this.searchVal = val
    },

    navSwitch(url) {
      uni.navigateTo({
        url
      })
    }
  }
}
</script>
<style lang="scss" scoped>
/* #ifdef APP-PLUS || MP-WEIXIN */
$bodyHeight: calc(100vh - 92px);
/* #endif */

/* #ifdef H5 */
$bodyHeight: calc(100vh - 92px - 44px);
/* #endif */

.wantBuy_page {
  .page-list {
    height: $bodyHeight;
  }
  .publishBtn {
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 9;
    width: 100%;
    background: #0049ac;
    text-align: center;
    line-height: 88rpx;
    font-size: 30rpx;
    font-family: PingFang SC;
    font-weight: 500;
    color: #ffffff;
  }
}
</style>